#include "world.h"

World::World()
{
	mScene.makePath("/root/sun/earth/moon");
	mScene.makePath("/root/sun/earth/ship");
	glClearColor(0, 0, 0, 1);
	mSun = gluNewQuadric();
	mEarth = gluNewQuadric();
	mMoon = gluNewQuadric();
	mEarthRot = 0;
	return;
}

World::~World()
{
}

void World::draw()
{
	glClear(GL_COLOR_BUFFER_BIT);
	glMatrixMode(GL_MODELVIEW);
	glPushMatrix();
	glTranslatef(0, 0, -100);
	glColor3f(1,0,0);
	gluSphere(mSun, 10, 10, 10);
	glPopMatrix();
}

void World::update()
{
	mEarthRot += 5;
	if (mEarthRot >= 360)
		mEarthRot = 0;
}

void World::resize(GLint width, GLint height)
{
	glViewport(0, 0, width, height);
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	gluPerspective(60, GLfloat(width)/GLfloat(height), 1, 400);
}
